package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: thoughtworker
 * Date: 10/11/13
 * Time: 9:41 AM
 * To change this template use File | Settings | File Templates.
 */
public class Movie {

    private String movieName;
    private String year;
    private String directorName;
    private String rating;

    public Movie(String movieName, String year, String directorName, String rating) {
        this.movieName = movieName;
        this.year = year;
        this.directorName = directorName;
        this.rating = rating;
    }

    public String displayMovieInfo() {
        return movieName + " \t" + year + " \t" + directorName + " \t" + rating + "\n";
    }

    @Override
    public boolean equals(Object other) {
        if (other == null){
            return false;
        }
        if (other == this) {
            return true;
        }
        if (!(other instanceof Movie)){
            return false;
        }

        Movie testMovie = (Movie) other;
        if (displayMovieInfo().equals(testMovie.displayMovieInfo())) {
            return true;
        } else {
            return false;
        }
    }
}
